/*
 * Created on 2005-6-23
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.linkage.util.exception;

import com.linkage.util.log.Logger;

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
@SuppressWarnings("serial")
public class MPException extends BaseException {
	/**
	 * 
	 */
	public MPException() {
	}

	/**
	 * @param e
	 */
	public MPException(Exception e) {
		if(e instanceof BaseException){
			this.setSuperException((BaseException)e);
		}else{
			setException(e);
			setErrorLevel(MPLEVEL);
			setDetailMessage(MPERRORINFO);
			log = Logger.getLogger();
			printErrorStackTrace(log,e);
//			log.error(e.getStackTrace().toString());
		}
	}

	/**
	 * @param e
	 * @param className
	 */
	public MPException(Exception e, String className) {
		if(e instanceof BaseException){
			this.setSuperException((BaseException)e);
		}else{
			setException(e);
			setErrorLevel(MPLEVEL);
			setDetailMessage(MPERRORINFO);
			log = Logger.getLogger(className);
			printErrorStackTrace(log,e);
//			log.error(e.getStackTrace().toString());
		}
	}

	/**
	 * @param e
	 * @param c
	 */
	public MPException(Exception e, Class<?> c) {
		if(e instanceof BaseException){
			this.setSuperException((BaseException)e);
		}else{
			setException(e);
			setErrorLevel(MPLEVEL);
			setDetailMessage(MPERRORINFO);
			log = Logger.getLogger(c);
//			e.printStackTrace();
			printErrorStackTrace(log,e);
//			log.error(e.getStackTrace().toString());
		}
	}

}
